package com.study.clients;

import com.study.controller.OpenFeignInterface;
import com.study.entity.OrderDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;

@FeignClient(value = "spring-cloud-order-service",fallback = OrderFeignClient.OrderServiceFeignClientFallback.class)
public interface OrderFeignClient extends OpenFeignInterface {

    @Component
    class OrderServiceFeignClientFallback implements OrderFeignClient{

        @Override
        public String getAllOrders() {
            return "查询订单失败，请稍候重试";
        }

        @Override
        public int insertOrders(OrderDto dto) {
            System.out.println("insert失败");
            return -1;
        }
    }

}
